﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BLL.SysManage
{
    public class T_PUB_WEDDINGTHEME
    {
        private readonly DALL.SysManage.T_PUB_WEDDINGTHEME dal = new DALL.SysManage.T_PUB_WEDDINGTHEME();
        public T_PUB_WEDDINGTHEME()
        { }


        /// <summary>
        /// 获取主题婚礼标题智能提示
        /// </summary>
        /// <param name="branch_id"></param>
        /// <returns></returns>
        public DataSet GetThemeWeddingTitel(int branch_id)
        {
            return dal.GetThemeWeddingTitel(branch_id);
        }

        public DataSet GetThemeWeddingTitel()
        {
            return dal.GetThemeWeddingTitel();
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetThemeList(string titel, int bid)
        {
            string strWhere = " FLAG = 1 ";
            if (!string.IsNullOrEmpty(titel))
            {
                strWhere += string.Format(" and TITEL like '%{0}%'", titel);
            }
            if (bid != -1)
            {
                strWhere += string.Format(" and BRANCH_ID = {0}", bid);
            }
            return dal.GetList(strWhere);
        }

        public void Add(Model.SysManage.T_PUB_WEDDINGTHEME model, IList<Model.Progect.T_PUB_FILE> addLsit, IList<Model.Progect.T_PUB_FILE> editList, IList<Model.Order.T_PUB_Order_Projectcs> PorjectList)
        {
            dal.Add(model, addLsit, editList, PorjectList);
        }

        public void Update(Model.SysManage.T_PUB_WEDDINGTHEME model, IList<Model.Progect.T_PUB_FILE> addLsit, IList<Model.Progect.T_PUB_FILE> editList, IList<Model.Order.T_PUB_Order_Projectcs> PorjectList)
        {
            dal.Update(model, addLsit, editList, PorjectList);
        }
          /// <summary>
        ///获得主题婚礼和图片
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public DataTable GetThemmFile(string strBRANCH_ID, string strWEDDING_COLOR, string strWEDDING_PRICE, string strWEDDING_MONTH, string strWEDDING_STYLE, string strHOTEL_NAME, string strType)
        {
            StringBuilder strWhere = new StringBuilder(" and T_PUB_WEDDINGTHEME.FLAG='1'");
            if (strBRANCH_ID!="")
            {
                strWhere.Append(string.Format("and  T_PUB_WEDDINGTHEME.BRANCH_ID='{0}'", strBRANCH_ID));
            }
            if (strWEDDING_COLOR!="")
            {
                strWhere.Append(string.Format(" and T_PUB_WEDDINGTHEME.WEDDING_COLOR='{0}'", strWEDDING_COLOR));
            }
            if (strWEDDING_PRICE != "")
            {
                strWhere.Append(string.Format(" and T_PUB_WEDDINGTHEME.WEDDING_PRICE='{0}'", strWEDDING_PRICE));
            }
            if (strWEDDING_MONTH != "")
            {
                strWhere.Append(string.Format(" and T_PUB_WEDDINGTHEME.WEDDING_MONTH='{0}'", strWEDDING_MONTH));
            }
            if (strWEDDING_STYLE != "")
            {
                strWhere.Append(string.Format(" and T_PUB_WEDDINGTHEME.WEDDING_STYLE like '%{0}'%", strWEDDING_STYLE));
            }
            if (strHOTEL_NAME != "")
            {
                strWhere.Append(string.Format(" and T_PUB_WEDDINGTHEME.HOTEL_NAME like '%{0}'%", strHOTEL_NAME));
            }
            if (strType != "")
            {
                strWhere.Append(string.Format(" and T_PUB_WEDDINGTHEME.Type = '{0}'", strType));
            }
            return dal.GetThemmFile(strWhere.ToString());
        }
        #region  Method
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.SysManage.T_PUB_WEDDINGTHEME model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.SysManage.T_PUB_WEDDINGTHEME model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string ID)
        {

            return dal.Delete(ID);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.SysManage.T_PUB_WEDDINGTHEME GetModel(string ID)
        {

            return dal.GetModel(ID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
 
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.SysManage.T_PUB_WEDDINGTHEME> GetModelList(string strWhere)
        {
            return dal.GetListArray(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        #endregion
    }
}
